package loja.model.seguranca;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Table;

@Entity
@Table(name = "usuario")
public final class Usuario implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "nome_usuario")
	private String nome = "";
	@Column(nullable = false)
	private String senha = "";
	private String nick = "";
	@ElementCollection
	@CollectionTable(name = "permissao_usuario", joinColumns = @JoinColumn(name = "nome_usuario"))
	@Column(name = "nome_permissao")
	private List<String> permissoes = new ArrayList<>();

	public Usuario() {
	}

	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public String getSenha() {
		return senha;
	}

	public void setSenha(String senha) {
		this.senha = senha;
	}

	public String getNick() {
		return nick;
	}

	public void setNick(String nick) {
		this.nick = nick;
	}

	public List<String> getPermissoes() {
		return permissoes;
	}

	public void setPermissoes(List<String> permissoes) {
		this.permissoes = permissoes;
	}

}
